package com.yanchi.util;

import java.util.Random;

public class ShiroUtil {

    private ShiroUtil(){

    }

    /**
     * 生成指定长度随机盐
     * @param n 盐的长度
     * @return
     */
    public static String getSlot(int n) {

        char[] chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*".toCharArray();

        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < n; i++) {
            char aChar = chars[new Random().nextInt(chars.length)];
            sb.append(aChar);
        }
        return sb.toString();

    }

}
